package com.example.malllocationserver.utils;
import com.qiniu.util.Auth;
import java.text.SimpleDateFormat;
import java.sql.Timestamp;
public class GetToken {
    String accessKey = "K9fL8d4-HmXRHRJz9hRP7NspfKgmrJQDO-jR3GMp";
    String secretKey = "-k9YYrWMeDNz6aXT5KPg0EtJWtJYLomJ2csjqurX";
    String bucket = "yu-heng";

    public String getToken(){
        Auth auth = Auth.create(accessKey, secretKey);
        String upToken = auth.uploadToken(bucket);
        return upToken;
    }

    //用于返回java.sql.date类型的变量
    public  java.sql.Timestamp strToDate(String strDate) {
        String str = strDate;
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");        //时间匹配
        java.util.Date d = null;
        try {
            d = format.parse(str);
            Timestamp timestamp = new Timestamp(d.getTime());
            return timestamp;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }//string格式转Date格式
    }

}
